package org.spring.boot.sample.hystrix.command;

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;

public class HystrixRequestCache extends HystrixCommand<Boolean>{

	private int value;
	
	public HystrixRequestCache(int value){
		super(HystrixCommandGroupKey.Factory.asKey("RequestCacheGroup"));
		this.value = value;
	}

	@Override
	protected Boolean run() throws Exception {
		return value == 0 || value % 2 == 0;
	}

	@Override
	protected String getCacheKey() {
		return String.valueOf(value);
	}
	
}
